package com.dfbz.utils;

import org.apache.commons.beanutils.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class SimDateUtils implements Converter {
    @Override
    public <T> T convert(Class<T> aClass, Object value) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dateTime = null;
        try {
            dateTime = simpleDateFormat.parse(value.toString());
            return (T)dateTime;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
